import unittest
from time import sleep
from selenium import webdriver
from page.page_search import Page


class TestSearch(unittest.TestCase):
    def setUp(self) -> None:
        self.options = webdriver.ChromeOptions()
        self.options.add_experimental_option("detach",True)
        self.driver = webdriver.Chrome(options=self.options)
        self.driver.maximize_window()
        self.driver.get("https://www.baidu.com")
        self.search = Page(self.driver)
    def tearDown(self) -> None:
        sleep(2)
        self.driver.get_screenshot_as_file("test.png")
        self.driver.quit()

    def test01_search(self):
        self.search.page_search("你好")
